package com.ZengQi.event.service.impl;

import com.ZengQi.event.dao.TopicDao;
import com.ZengQi.event.dao.impl.TopicDaoImpl;
import com.ZengQi.event.entity.Finish;
import com.ZengQi.event.entity.Topic;
import com.ZengQi.event.service.TopicService;

import java.util.List;

public class TopicServiceImpl implements TopicService {
    private final TopicDao topicDao=new TopicDaoImpl();
    @Override
    public boolean saveTopic(Topic topic) {
        return topicDao.insertTopic(topic);
    }

    @Override
    public List<Topic> findListTopic(Topic conditionTopic) {
        return topicDao.listTopics(conditionTopic);
    }

    @Override
    public List<Topic> findListFinish(Finish conditionFinish) {
        return topicDao.listFinshTopics(conditionFinish);
    }

    @Override
    public boolean removeTopic(Topic conditionTopic) {
        return topicDao.deleteTopic(conditionTopic);
    }

    @Override
    public boolean modifyTopicByPublisher(Topic topic) {
        return topicDao.updateTopicByPublisher(topic,topic.getTopicPublisher());
    }
}
